package com.techshine.service.impl;

import javax.annotation.Resource;
import java.util.List;
import org.springframework.stereotype.Service;

import com.techshine.service.NewsService;
import com.techshine.entity.News;
import com.techshine.mapper.NewsMapper;

 
/** 
 * 说明： 新闻
 * 
 */
@Service
public class NewsServiceImpl implements NewsService {
	
	@Resource
	private NewsMapper newsMapper;
	@Override
	public News queryByKey(String id)throws Exception{
		return newsMapper.queryByKey(id);
	}
	@Override
	public List<News> queryListByPage(News entity)throws Exception{
		return newsMapper.queryListByPage(entity);
	}
	@Override
	public List<News> queryList(News entity)throws Exception{
		return newsMapper.queryList(entity);
	}
	@Override
	public void insert(News entity)throws Exception{
		newsMapper.insert(entity);
	}
	@Override
	public void insertSelective(News entity)throws Exception{
		 newsMapper.insertSelective(entity);
	}
	@Override
	public void update(News entity)throws Exception{
	 	newsMapper.update(entity);
	}
	@Override
	public void updateByKeySelective(News entity)throws Exception{
		 newsMapper.updateByKeySelective(entity);
	}
	public void delete(News entity)throws Exception{
		 newsMapper.delete(entity);
	}
	@Override
	public void delmore(String ids) throws Exception {
		// TODO Auto-generated method stub
		String[] split = ids.split(",");
		News node=new News();
		for(String id:split) {
			node.setId(Integer.parseInt(id));
			newsMapper.delete(node);
		}
	}
}

